import { _decorator, Component, log, v3, view, UITransform, Enum } from 'cc';
const { ccclass, property } = _decorator;

export enum ResizeMode {
    Stretch,
    FixAspect
}
Enum(ResizeMode);

@ccclass('FirstResize')
export class FirstResize extends Component {

    @property
    scale: number = 1;

    start() {
        const size = view.getVisibleSize();
        log('@FirstResize', size);

        this.node.getComponent(UITransform).width = size.width;
        this.node.getComponent(UITransform).height = size.height;
        // if (size.width > 720) { // 宽较大，如果是背景图片的话，需要放大
        //     this.node.getComponent(UITransform).width *= size.width / 720;
        // }
        // if (size.height > 1280) {
        //     this.node.getComponent(UITransform).width *= size.height / 1280;
        // }

        this.node.scale = v3(this.scale, this.scale, this.scale);
    }
}


